const mysql = require('mysql')

const db = mysql.createConnection({
    password:'123456',
    port:3306,
    user:'root',
    database:'2007b',
    host:'localhost'
    
})

const query = (sql) => {
    return new Promise((resolve, reject) => {
        db.query(sql,(err,result)=>{
            if(err)reject(err)
            resolve(result)
        })
    })
}

module.exports=query